package cn.itcast.bos.web.action.base;

import cn.itcast.bos.domain.base.TakeTime;
import cn.itcast.bos.service.base.TakeTimeService;
import cn.itcast.bos.utils.BaseAction;
import com.opensymphony.xwork2.ActionContext;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;


import java.util.List;

/**
 * Created by Administrator on 2017/7/26.
 */
@Controller
@Namespace("/")
@ParentPackage("json-default")
@Scope("protoType")
public class TakeTimeAction extends BaseAction<TakeTime> {
    @Autowired
    private TakeTimeService takeTimeService;
   @Action(value = "takeTime_findAll",results = {@Result(name="success",type = "json")})
    public String findAll(){
       List<TakeTime> takeTimeList =  takeTimeService.findAll();
       //将返回值压入栈顶返回
        ActionContext.getContext().getValueStack().push(takeTimeList);
        return SUCCESS;
    }
}
